/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ar.edu.utn.frsf.tpae.a2012.g03.model;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;


/**
 *
 * @author fededalla
 * Clase del modelo que representa un concepto abstracto de un movimiento
 * bancario
 */
@Entity
@Table(name = "mov")
@Inheritance(strategy=InheritanceType.JOINED)
public abstract class Movimiento {
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "mov_id", nullable = false)
    private Integer movId;
	@Column(name = "mov_fech", nullable = false)
    private Date movFech;
	@Column(name = "mov_mont", nullable = false)
    private double movMont;
    @ManyToOne
    @JoinColumn(name = "mov_cta_id", referencedColumnName = "cta_id")
    private Cuenta movCtaId;

    /**
     * Constructor
     */
    public Movimiento() {
    }

    /**
     * Constructor
     * @param movId
     */
    public Movimiento(Integer movId) {
        this.movId = movId;
    }

    /**
     * Constructor completo
     * @param movFech
     * @param movMont
     * @param unaCuenta
     */
    public Movimiento(Date movFech, double movMont, Cuenta unaCuenta) {
        this.movFech = movFech;
        this.movMont = movMont;
        this.movCtaId = unaCuenta;
    }

	public Integer getMovId() {
        return movId;
    }

    public void setMovId(Integer movId) {
        this.movId = movId;
    }

    public Date getMovFech() {
        return movFech;
    }

    public void setMovFech(Date movFech) {
        this.movFech = movFech;
    }

    public double getMovMont() {
        return movMont;
    }

    public void setMovMont(double movMont) {
        this.movMont = movMont;
    }

    public Cuenta getMovCtaId() {
        return movCtaId;
    }

    public void setMovCtaId(Cuenta movCtaId) {
        this.movCtaId = movCtaId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (movId != null ? movId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Movimiento)) {
            return false;
        }
        Movimiento other = (Movimiento) object;
        if ((this.movId == null && other.movId != null) || (this.movId != null && !this.movId.equals(other.movId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Movimiento";
    }
    
}
